// 获取未中奖金额
export function getOffMony() {
	// 概率 
	const moneys = [20, 50, 100, 500, 1000, 10000, 50000, 100000, 500000, 1000000]
	const rate = getRandomNum(100);
	let level = 0;
	if (rate < 20) {
		level = 0
	} else if (rate < 30) {
		level = 1
	} else if (rate < 40) {
		level = 2
	} else if (rate < 50) {
		level = 3
	} else if (rate < 60) {
		level = 4
	} else if (rate < 70) {
		level = 5
	} else if (rate < 80) {
		level = 6
	} else if (rate < 90) {
		level = 7
	} else if (rate < 95) {
		level = 8
	} else if (rate <= 100) {
		level = 9
	} else {
		level = 0
	}

	return moneys[level]
}


// 获取中奖金额
export function getOnMony() {
	// 概率 
	const moneys = [20, 50, 100, 500, 1000, 10000, 50000, 100000, 500000, 1000000]
	const rate = getRandomNum(1000000);
	let level = 0;
	if (rate < 500000) { // 20
		level = 0
	} else if (rate < 700000) { // 50
		level = 1
	} else if (rate < 800000) { // 100
		level = 2
	} else if (rate < 900000) { // 500
		level = 3
	} else if (rate < 990000) { // 1000
		level = 4
	} else if (rate < 999000) { // 10000
		level = 5
	} else if (rate < 999900) { // 50000
		level = 6
	} else if (rate < 999980) { // 100000
		level = 7
	} else if (rate < 999998) { // 500000
		level = 8
	} else if (rate <= 1000000) { //1000000
		level = 9
	} else {
		level = 0
	}

	return moneys[level]
}

export function getRandomNum(num) {
	return Math.floor(Math.random() * num) + 1;
}

export function getPinyinWithNum(num) {
	const numToZh = ["LING", "YI", "ER", "SAN", "SI", "WU", "LIU", "QI", "BA", "JIU", "SHI"]
	if (num < 10) {
		return numToZh[0] + numToZh[num];
	} else {
		const shi = parseInt(num / 10);
		const ge = parseInt(num % 10);
		return numToZh[shi] + numToZh[ge];
	}
}

//数字前面加0
export function padZero(number, length) {
	return String(number).padStart(length, '0');
}